<?php include("../../includes/includes.php"); ?>
<?php
connect($config);
$playerId=$_POST['newPlayer'];
$playerPosition=$_POST['playerPosition'];
$skipMyPick=$_POST['skipMyPick'];

$loggedInTeam = getLoggedInTeam();

if ($skipMyPick == "true") {
    skipMyPick($loggedInTeam->id, $loggedInTeam->leagueId);
    $redirect = 'Location: ../home/homePage.php';
}
else if (makeMyPick($loggedInTeam->id, $playerId, $playerPosition)) {
	checkSubsequentTeamPreferences($loggedInTeam->leagueId);
	
	$redirect = 'Location: ../home/homePage.php';
}
else {
	$redirect = 'Location: ../home/homePage.php?makeMyPickError=true';
}
mysql_close();

header($redirect);
?>